$(function() {
	$('#vue_vm_list div').hide();
});

var elderWallet = {
	elderWalletId: '',
	elderId: '',
	elderName: '',
	elderCarId: '',
	walletBalance: '',
	remindStatus: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	userRfidCardId: '',
};

var view = {
	data: elderWallet
};

function recharge() {
	var elderWalletId = $('#elderWalletId').val();
	var money = parseFloat($('#money').val());
	
	if(!elderWalletId || elderWalletId=='') {
		alert('请选择钱包');
		return;
	}
	
	if(isEmpty(money) || money==0) {
		alert('请输入充值金额');
		return;
	}
	
	if(confirm('确定充值' + money + '元吗？')) {
			save_basic_by_json(path+'/elderWallet/recharge', {id:elderWalletId, money:money, updateId:view.data.updateId}, function(response) {
			alert('充值成功');
			//document.location.href = '3-5-1moneyadd-1.html?pageParam='+encodeURIComponent(JSON.stringify(response.data[0]));
			var pageParam = {};
			pageParam.elderId = view.data.elderId;
			pageParam.elderName = response.data[0].elderName;
			pageParam.payType = '预缴款';
			pageParam.pay = money;
			pageParam.staffName = getLoginedUser()? getLoginedUser().staffName: '';
			pageParam.payDate = getStandardNowDay();
			pageParam.paperType = 2;
			pageParam.relationId = response.data[0].elderWalletRechargeRecordId + '-walletRecharge';
			pageParam.beHospitalId =response.data[0].beHospitalId;
			pageParam.beNumber = response.data[0].elderBeHospitalForm.beNumber;
			window.open('0_print_jf.html?pageParam='+encodeURIComponent(JSON.stringify(pageParam)));
		});
	}
}

function deleteBatch() {
	deleteBatch_basic(path+'/elderWallet/deleteBatch');
}


var autoSearchDetail = function(searchVal) {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();
	
	openWaiting('正在查找');
	
	find_basic(path+'/elderWallet/find', searchVal, function(response) {
		closeWaiting();
		
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}
